Skip to content

fix: restrict view-mode click activation to content column (Closes #221)#230

Merged
oobagi merged 1 commit into
mainfrom
feat/issue-221-click-margin-guard
Apr 25, 2026
Merged

fix: restrict view-mode click activation to content column (Closes #221)#230
oobagi merged 1 commit into
mainfrom
feat/issue-221-click-margin-guard

Conversation

@oobagi
Copy link
Copy Markdown
Owner

@oobagi oobagi commented Apr 25, 2026

Summary

  • Adds viewContentXRange() helper as the single source of truth for the centered view-mode column bounds.
  • Click handler rejects coordinates outside [leftPad, leftPad+contentWidth) so margin clicks no longer toggle checklists or open embeds.
  • Hover handler narrows the same way, keeping visual feedback consistent with activation.

Test plan

  • go test ./... — all green
  • go vet ./... — clean
  • New tests: TestMouseClickInLeftMarginDoesNotToggle, TestMouseClickInRightMarginDoesNotToggle
  • Manual: open a note with a checklist, enter view mode, click far left and far right of the line — toggle should not fire; click on the content — toggle still fires.

🤖 Generated with Claude Code

Clicks in the wide horizontal margins around the centered view-mode
column previously fell through to whichever block they shared a row
with, causing accidental checklist toggles and embed opens when the
user was just clicking around to focus the terminal or select text.

Adds viewContentXRange() as the single source of truth for the
[leftPad, leftPad+contentWidth) bounds and uses it in both the click
and hover handlers so visual feedback matches activation. Hover is
narrowed too, so the highlight no longer suggests clickability in
margins where clicks won't fire.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@oobagi oobagi merged commit 39744ac into main Apr 25, 2026
1 check passed
@oobagi oobagi deleted the feat/issue-221-click-margin-guard branch April 25, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant